<?php
/**
 * <b>RUBIK IT Solution & Development ltd.</b>
 *
 * PROJECT		: Rubik Ultimate Framework
 * @version 	: 1.1
 * COPYRIGHT    : 2008
 * ------------------------------------------------------
 * 
 * Created on	:  Jun 16, 2008
 * 
 */

// no direct access
defined ( '_FW_EXEC' ) or die ( 'Restricted access' );

define ( 'DS', DIRECTORY_SEPARATOR );
define ( 'SYS_ROOT_PATH', realpath ( dirname ( __FILE__ ) . "/../.." ) . DS );

// define admin path information
define ( 'SYS_ADMIN_PATH', SYS_ROOT_PATH . 'administrator' . DS );

// Include importers
require (SYS_ROOT_PATH . "core/error/RError.class.php");

//*		// Short way import for production
require (SYS_ROOT_PATH . "core/importer/_StaticImporters.php");
/*/ 	// Full way import for develop
require (SYS_ROOT_PATH . "core/importer/AbstractStaticImporter.class.php");
require (SYS_ROOT_PATH . "core/importer/RCoreImporter.class.php");

RCoreImporter::cls( "importer.RExtImporter" );
RCoreImporter::cls( "importer.RRootImporter" );
RCoreImporter::cls( "importer.RLibImporter" );
RCoreImporter::cls( "importer.RClassesImporter" );
RCoreImporter::cls( 'importer.RAppImporter' );
//*/

// Include the Object class
RCoreImporter::cls( "base.Object" );

// Define URL information
//$sProtocol = $_SERVER ["SERVER_PROTOCOL"];
//$sProtocol = substr ( $sProtocol, 0, strpos ( $sProtocol, "/" ) );

if($_SERVER['HTTPS']) {
 $sProtocol = 'http';
} else {
 $sProtocol = 'http';
}

$sProtocol = strtolower ( $sProtocol ) . "://";

$sHostName = $_SERVER ['HTTP_HOST'];
$arr = explode ( "/", $_SERVER ['PHP_SELF'] );
$i = count ( $arr ) - 1;
if ($i >= 0) {
	unset ( $arr [$i] );
}
$i --;
$admin = 'administrator';
if (SYS_WORK_ZONE == 'back' && $arr [$i] == $admin) {
	unset ( $arr [$i] );
}
$admin .= '/';
if (SYS_WORK_ZONE == 'runAlone') {
	unset ( $arr [$i --] ); // remove runAlone
	unset ( $arr [$i] ); // remove core
}
$uri = implode ( "/", $arr );
$rootUrl = $sProtocol . $sHostName . $uri . "/"; // do not modify this line


define ( 'SYS_ROOT_URL_WITHOUT_PROTOCOL', $uri );
define ( 'SYS_ROOT_URL', $rootUrl );
define ( 'SYS_ADMIN_URL', $rootUrl . $admin );

/**
 * Define the Path into the module configuration folder.
 * Define the Path into the plugin configuration folder.
 *	EX: <root>/config/modules
 */ 
define ( "SYS_MOD_CONFIG_PATH", SYS_ROOT_PATH . "config" . DS . "modules" . DS );
define ( "SYS_PLUGIN_CONFIG_PATH", SYS_ROOT_PATH . "config" . DS . "plugins" . DS );

define ( 'SYS_PLUGIN_PATH', SYS_ROOT_PATH . "plugins" . DS );
define ( 'SYS_PLUGIN_URL', SYS_ROOT_PATH . "plugins/" );
?>
